package android.car;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.content.Intent;
import android.content.pm.ActivityInfo;

public class Menu extends Activity implements OnClickListener {
	private Button btn_server, btn_client, btn_exit;
	
	@Override
	protected void onDestroy() {
		super.onDestroy();
	}
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.main);
		btn_server = (Button) findViewById(R.id.btn_server);
		btn_server.setOnClickListener(this);
		btn_client = (Button) findViewById(R.id.btn_client);
		btn_client.setOnClickListener(this);
		btn_exit = (Button) findViewById(R.id.btn_exit);
		btn_exit.setOnClickListener(this);

	}
	
	@Override
	public void onClick(View v) {
		int id = v.getId();
        Bundle bundle = new Bundle();
		switch(id){
			case R.id.btn_server:
		        bundle.putString("Be", "Car");
		        Intent intent_server = new Intent();
		        intent_server.setClass(this, Car.class);
		        intent_server.putExtras(bundle);
		        startActivity(intent_server);
				break;
			case R.id.btn_client:
				bundle.putString("Be", "Phone");
		        Intent intent_client = new Intent();
		        intent_client.setClass(this, Car.class);
		        intent_client.putExtras(bundle);
		        startActivity(intent_client);
				break;
			case R.id.btn_exit:
		        finish();
				break;
		}
	}
}
